//
//  FirstTableViewController.swift
//  KKNavigationBarDemo
//
//  Created by liaozhenming on 2016/12/23.
//  Copyright © 2016年 liaozhenming. All rights reserved.
//

import UIKit

class FirstTableViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        FirstTableViewController.kk_registerCustomizedNavigationBar()
        self.kk_setNavigationBarBackgroundColor(UIColor.red, alpha: 1.0)
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source

    override func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 50
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "FirstCellIdentifier", for: indexPath)

        cell.textLabel?.text = String(indexPath.row)
        return cell
    }
    
    override func scrollViewDidScroll(_ scrollView: UIScrollView) {
        
//        let offsetY = scrollView.contentOffset.y
//        
//        if offsetY > 0 {
//            let alpha = 1 - (64 - offsetY)/64.0
//            self.kk_updateNavigationBarBackgroundColor(withAlpha: alpha)
//        }
//        else {
//            self.kk_updateNavigationBarBackgroundColor(withAlpha: 0)
//        }
    }
}
